package driver;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;

import world3d.IWorld;
import world3d.World3d;
import exp.DummyExperiment;
import exp.Experiment;

/**
 * "driver" for the experiment : it is an endless loop.
 * 
 * @author bastian marquis
 */
public class Driver extends JFrame{
	
	/**
	 * The model for the experiment, built from a file
	 */
	private Experiment exp;
	
	/**
	 * 
	 * 
	 */
	private IWorld world;
	
	/**
	 * Build the experiment from a file
	 * 
	 * @param file
	 */
	public Driver(String file){
		this(); // call the default constructor
	}
	
	/**
	 * Build a "dummy" experiment, to be removed in the final version
	 */
	public Driver(){
		super("3d world");
		
		World3d w = new World3d();
		world = w;
		
		Container c = this.getContentPane();
		exp = new DummyExperiment();
		
		c.setLayout(new BorderLayout());
		c.add(w, BorderLayout.CENTER);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		pack();
		this.setResizable(false);
		this.setVisible(true);
	}
	
//	public void run(){
//		char choice;
//		
//		while(!exp.isEnd()){
//			choice = world.getChoice();
//			
//			switch(choice){
//			case 'L' :
//				exp.takeLeft();
//				world.transition(exp.getCurrentPos());
//			case 'R' :
//				exp.takeRight();
//				world.transition(exp.getCurrentPos());
//			case 'Q' : 
//				return;
//			default :
//				System.out.println("Wrong key!!");
//			}
//		}
//	}
}
